import Command from "./command"
const selectBy = {
  all: "all",
  byFloorId: "byFloorId",
  byRoomId: "byRoomId",
  byMeshGroup: "byMeshGroup",
  byMeshSubGroup: "byMeshSubGroup"
}
const colorBy = {
  explicit: "explicit",
  random: "random"
}
export class SetMeshOverlayCommand extends Command {
  static selectBy: Record<string, string>
  static colorBy: Record<string, any>
  static COLOR_DIM: Record<string, number>
  constructor(colorStyle?: Record<string, any>, selectBy?: Record<string, string>) {
    super()
    this.id = "SET_MESH_OVERLAY_COLOR"
    this.payload = {
      selectBy: selectBy?.style || selectBy.all,
      colorStyle: colorStyle?.style || colorBy.explicit,
      color: colorStyle?.color || null,
      alpha: colorStyle?.alpha || 0.5,
      id: selectBy?.id,
      index: selectBy?.index
    }
  }
}
SetMeshOverlayCommand.selectBy = selectBy
SetMeshOverlayCommand.colorBy = colorBy
SetMeshOverlayCommand.COLOR_DIM = { x: 0, y: 0, z: 0, w: 0.3 }

export class ToggleMeshOverlayColorCommand extends Command {
  constructor(enabled: any) {
    super()
    this.id = "TOGGLE_MESH_OVERLAY_COLOR"
    this.payload = { enabled }
  }
}
export class CreateMeshTrimCommand extends Command {
  constructor(e: any) {
    super()
    this.payload = e
    this.id = "CREATE_MESH_TRIM"
  }
}
export class DeleteMeshTrimCommand extends Command {
  constructor(e: any) {
    super()
    this.payload = e
    this.id = "DELETE_MESH_TRIM"
  }
}
export class MeshPreviewSetPositonCommand extends Command {
  constructor(enabled: any, previewCirclePosition?: any, size?: any) {
    super()
    this.id = "MESH_PREVIEW_POSITION"
    this.payload = {
      enabled,
      previewCirclePosition,
      size
    }
  }
}
